home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / vopl / glvopl.lha / glvopl / examples / fex3.F < prev    next >
Encoding:
Text File  |  1993-10-07  |  2.0 KB  |  134 lines

  1. c
  2. c    Another simple test program for vopl.
  3. c
  4. c     This one tries to show the various "fit" options
  5. c
  6.     program test3
  7. #ifdef SGI_GL
  8. #include "fgl.h"
  9. #include "fdevice.h"
  10. #else
  11. #include "fvogl.h"
  12. #include "fvodevice.h"
  13. #endif
  14.  
  15.     parameter (n = 10)
  16.  
  17.     real x(n), y(n)
  18.  
  19.     character device*30
  20.  
  21.     integer *2 val
  22.     
  23.     data x/1.0, 2.0, 3.0, 6.0, 17.0, 19.0, 23.0, 45.0, 50.0, 56.0/
  24.     data y/1.0, 3.0, 5.0, 9.0, 17.0, 45.0, 23.0, 99.0, 50.0, 20.0/
  25. c
  26. c    Get VOGL device
  27. c
  28.     write(*,'(a,$)') 'Enter VOGL device: '
  29.     read(*,'(a)') device
  30.  
  31. c
  32. c    First we'll do a linear least square fit.
  33. c
  34.     call fit(2)
  35.     call degree(1)
  36. c
  37. c    Adjust the scaling according to x and y arrays
  38. c
  39.     call adjustscale(x, n, 'x')
  40.     call adjustscale(y, n, 'y')
  41. c
  42. c    Give it a title
  43. c
  44.     call graphtitle('Linear Least square fit')
  45. c
  46. c    As we are now about to do some graphics we initialise VOGLE
  47. c    and clear to BLACK
  48. c
  49.     call hfont('futura.m', 8)
  50.     call winope('VOPL', 4)
  51.     call qdevic(KEYBD)
  52.     call color(0)
  53.     call clear
  54. c
  55. c    Draw the title in CYAN
  56. c
  57.     call color(6)
  58.     call drawtitle
  59. c
  60. c    Now set the color to GREEN
  61. c
  62.     call color(2)
  63.  
  64. c
  65. c    Draw the default set of axes (in GREEN)
  66. c
  67.     call drawaxes2
  68. c
  69. c    Set color to RED
  70. c
  71.     call color(1)
  72. c
  73. c    Change to the "markers" font and set the current marker string
  74. c
  75.     call hfont('markers', 7)
  76.     call marker('a')
  77. c
  78. c    Draw the Graph
  79. c
  80.     call plot2(x, y, n)
  81. c
  82. c    Wait around a bit
  83. c
  84.     idum = qread(val)
  85. c
  86. c    Now we'll do a second order fit.
  87. c
  88.     call degree(2)
  89.     call graphtitle('Second order least square fit')
  90.  
  91.     call color(0)
  92.     call clear
  93.  
  94.     call color(7)
  95.     call plot2(x, y, n)
  96. c
  97. c    Change back to the "text" type font to draw the title and axes
  98. c
  99.     call hfont('futura.m', 8)
  100.  
  101.     call color(3)
  102.     call drawaxes2
  103.  
  104.     call color(6)
  105.     call drawtitle
  106. c
  107. c     Wait a bit
  108. c
  109.     idum = qread(val)
  110. c
  111. c    Now do a Cubic spline fit (cardinal spline for this one)
  112. c
  113.     call fit(3)
  114.     
  115.     call color(0)
  116.     call clear
  117.  
  118.     call color(5)
  119.     call drawaxes2
  120.  
  121.     call graphtitle('Cardinal Cubic Spline Fit')
  122.     call color(6)
  123.     call drawtitle
  124.  
  125. c
  126. c    Note, we haven't changed to the Marker font here
  127. c
  128.     call plot2(x, y, n)
  129. c
  130.     idum = qread(val)
  131.  
  132.     call gexit
  133.     end
  134.